package com.itheima.youdianda.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.youdianda.domain.SysRole;
import com.itheima.youdianda.dto.SysRoleDto;
import com.itheima.youdianda.service.SysRoleService;
import com.itheima.youdianda.mapper.SysRoleMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author YUAN
* @description 针对表【sys_role(角色表)】的数据库操作Service实现
* @createDate 2022-09-06 18:36:38
*/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole>
    implements SysRoleService{

    @Override
    public List<String> roleNameList(List<String> ids) {
        List<SysRole> sysRoles = super.listByIds(ids);

        return CollUtil.getFieldValues(sysRoles,"name",String.class);
    }

    @Override
    public SysRoleDto getRoleDto(String id) {
        return baseMapper.getRoleDto(id);
    }
}




